package com.qczl.pme.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qczl.core.controller.BaseController;
import com.qczl.pme.service.FingerService;

/**
 * 指纹机通知接口
 * @author SongR
 *
 */
@Controller
@RequestMapping(value="/finger")
public class FingerController extends BaseController{

	Logger log = LoggerFactory.getLogger(this.getClass());
	@Autowired
	FingerService service;
	
	/**
	 * 链接指纹机
	 * @作者:SongR
	 * @版本:v1
	 * @日期:2017年9月25日 上午11:38:15
	 */
	@ResponseBody
	@RequestMapping(value="/connect/v1")
	public void connectV1(String stbNo){
		try {
			//TODO 链接指纹机
		} catch (Exception e) {
			log.error("链接指纹机接口异常！",e);
		}
//		String s = HttpClientUtil.doGet("http://192.168.1.21:4050?cmd=GetLogData&ip=192.168.2.251&"
//				+ "port=4370&type=metting&mettingid=1",null);
	}
	
	
	/**
	 * 指纹机通知
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/notify/v1",method={RequestMethod.GET,RequestMethod.POST})
	public void notifyV1(String userid,String type,String mettingid){
		System.out.println(userid+"\ttype="+type+"\t"+mettingid);
		if(type.equals("metting")){
			try {
				service.notifyV1(userid,mettingid);
			} catch (Exception e) {
				log.error("签到失败！",e);
//				e.printStackTrace();
			}
		}
//		HttpClientUtil.doGet("http://192.168.2.62:8080/qczl.pme/finger/notify/v1?userid="+userid+"&type="+type+"&mettingid="+mettingid,null);
	}
	
	
	
}
